“SLALOM” by Davide Fichera (Naufr4g0)
2018 BASIC 10-Liner contest
(category: PUR-120)

SPECS
=====
Hardware: Commodore 64
Language: Standard BASIC V2

OBJECTIVE
=========
A slalom course is constructed by laying out a series of gates. The skier must pass between the two poles forming the gate to avoid penalties (each skipped gate give you a 5 sec penalty). Since this is a videogame, and not the real sport, a variable number of trees has been inserted to make things more challenging.

GAMEPLAY
========
At each start of the game, you were prompted to input a SEED for the random number generator. Each seed corresponds to a different procedurally-generated course. You can use the same seed at each start to perform a better time in the same course or select a totally different one.
Time is not displayed continuously for performance issues, so you can read it only at the of the race.
Try this SEEDS: 42 (short track), 777 (medium length track with challenging trees), 999 (a long fast track with a lot of trees).

Controls
--------
Use joystick in port #2 to move the skier to the right or to the left.
At the end of the race use Fire button to start over.


SLALOM - BASIC code
===================
0 dimu,x,w,y,l,m,t:readV,S,SP,JO,ZZ,A,s$:fori=Sto16383:pokei,.:next:fori=0to7:forj=0to23step3:p=p+1:pokeS+i*64+j,asc(mid$(s$,p,1)):next:next
1 q=4:r=8:f=255:gosub8:pokeSP,FC:fori=1to9:reada0,b:pokeV+a0,b:next:X=176:Z=88:fori=0to2:readl(i),h(i):forj=0to3:readt$(i,j):next:next:gosub9
2 j=PEEK(JO):U=U+((JANDQ)=.)-((JANDR)=.):X=X+U:POKEV,XANDF:POKEV6,-(X>=F0):IFABS(U)>MUTHENU=SGN(U)*MU:data53248,15872,2040,56320,22,16
3 POKESP,fng(U):M=R-ABS(U):W=W+AW:on-(W>M)gosub5:Y=Y+W:ON-(Y>R)GOSUB6:ON-EGOTO4:C=PEEK(SC+X/R):ON-(C=CS)GOTO2:IFC=CFTHENN=N+l-D:D=1:GOTO2
4 pokesp,FC-Q*(C<>CS):i=g-n:ts=int((ti-tr)*k)/100+i*5:PRINT"{home}{blue}{reverse off}t="ts"{red}"i:fori=ztoz-(246-z)*(C=CS)+6stepw/r:pokev+1,i:next:waitJO,a,f:run
5 W=M:RETURN:data"{24}{25}{30}{24}{24}{36}{206}{48}{24}{58}{60}{24}{24}{36}{72}{16}{88}{89}{62}{24}{60}{36}{36}{72}{24}{189}{90}{24}{60}{36*3}{26}{154}{124}{24}{60}{36}{36}{18}{24}{92}{60}{24}{24}{36}{18}{ct h}{24}{152}{120}{24}{24}{36}{115}{12}{230}{24}{62}{89}{24}{60}{90}{36}",17,23,21,1,1,88,39,2,23,1,29,1,32,1,33,1,
6 Y=Y-R:D=0:on-(O=.)gosub7:print:PRINTTAB(P)T$(T,O);:O=O+lANDH(T):H=H+l:E=H>LG:RETURN:data176,5,3,,,,"{light gray}DEDF{cm p}",12,7,,,"{blue}{reverse on}{space*2}{reverse off}{space*8}{reverse on}{space*2}"
7 T=1-(RND(l)<RG)::T=-T*(H<=LG-ZZ):G=G-(T=l):P=INT(RND(l)*(39-l(T))):RETURN:data"{cm h}{cm m}{sh space*8}{cm h}{cm m}",6,3,"{space}{reverse on}{green}{190}{188}","{reverse on}{161}{163}{space}{reverse off}{161}","{reverse on}{space*2}{163}{183}"
8 s=rnd(1)*v:?"{clear}{down*4}"tab(a)"{blue}Q      Q":?tab(a)"B      B":l=1:f0=256:fc=251:v6=v+a:AW=.06:mu=7:CS=32:CF=96:SC=1262:k=5/3:return
9 deffng(x)=FC+int(abs(x/2))*sgn(x):input"{home}seed";s:c=rnd(-s):rg=rnd(1)*.3+.5:lg=64*int(rnd(1)*8+1):poke214,24:tr=ti:return:data"{reverse on}{187}{163}{space}{172}"
----
Note: you can copy/paste the program code into CBM Prg Studio (http://www.ajordison.co.uk/) and test
      the game inside it (just press F5) after you have started a new project.

